/*
 *说明：机构信息表 增加/修改脚本
 *
 *@author liuxun 2012-03-06
*/

var opeForm;
var operationType;

$(function(){

	opeForm=$('#opeForm');
	operationType = $('#operationType').val();

	if (operationType == 0) {
		opeForm.url = 'A_ORG!doInsert.do';

	} else if(operationType == 1){
		opeForm.url = 'A_ORG!doUpdate.do';

	} 

	$('#okBtn').click(doOk);
	$('#cancelBtn').click(closeWin);
});

//保存按钮操作
function doOk() {
	
	var validateResult = opeForm.form('validate');

	if (!validateResult){
		showInfoWin('请正确填写信息!');
		return;
	}
 //   alert('11111');
	var options = { 
		url: opeForm.url,
		type: 'post',
		success: function(data){
			getOpenerWin().afterOK(operationType,data);

		    if (operationType == '0') {
		    	
				showInfoWin('操作成功!', function() {window.close();});
				//window.close();

			} else {
				showInfoWin('操作成功!', function() {window.close();});
			}
		}
	};

	opeForm.ajaxSubmit(options);
}
